package com.woniu.microprojectserver.buildclassmag.service.impl;

import com.woniu.microcommonsserver.entity.BuildClassInfoEntity;
import com.woniu.microprojectserver.buildclassmag.mapper.BuildClassMapper;
import com.woniu.microprojectserver.buildclassmag.service.IBuildClassService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author ：pengchufeng
 * @date ：Created in 2021/1/30
 * @description：项目类型service接口实现
 */
@Transactional(readOnly = true)
@Service
public class BuildClassServiceImpl implements IBuildClassService {
    @Resource
    private BuildClassMapper buildClassMapper;

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public List<BuildClassInfoEntity> findAll() {
        return buildClassMapper.findAll();
    }

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public List<BuildClassInfoEntity> findByName(@Param("name")String name) {
        return buildClassMapper.findByName(name);
    }

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public boolean add(BuildClassInfoEntity buildClassInfoEntity) {
        buildClassMapper.add(buildClassInfoEntity);
        return true;
    }

    @Override
    @Transactional(isolation = Isolation.REPEATABLE_READ,rollbackFor = Exception.class)
    public boolean update(BuildClassInfoEntity buildClassInfoEntity) {
        buildClassMapper.update(buildClassInfoEntity);
        return true;
    }
}
